public class Solution1411 {
    public int numOfWays(int n) {
        if (n==1){
            return 12;
        }
        if (n==2){
            return 54;
        }
        long a=30,b=6,c;
        int mod=1000000007;
        for (int i=3;i<=n;i++){
            c=(a*5-2*b)%mod;
            b=a;
            a=c;
        }
        long ans=((2*a-b)%mod+mod)%mod;
        return (int)ans;
    }

    public static void main(String[] args) {
        System.out.println(new Solution1411().numOfWays(5000));
    }
}
